package lancamento;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.text.ParseException;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;

import entidade.Fatura;
import model.FaturaTableModel;
import principal.JFPrincipal;

import javax.swing.ImageIcon;
import javax.swing.border.EmptyBorder;

@SuppressWarnings("serial")
public class JIFFatura extends JDialog {

	private JPanel contentPane;
	private JPanel fieldPane;
	private JPanel balancePane;
	private JPanel buttonPane;
	private JTable table;
	private JLabel lbVl_Fatura;
	private DecimalFormat df;

	public JIFFatura(JFPrincipal fPrincipal) throws SQLException,
			ClassNotFoundException {
		super(fPrincipal);
		setBounds(100, 100, 581, 316);
		setLocationRelativeTo(this);
		setTitle("Ger\u00EAncia de Fatura");
		setModal(true);

		contentPane = new JPanel(new BorderLayout());
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);

		df = new DecimalFormat("###,##0.00");

		fieldPane = new JPanel(new BorderLayout());
		contentPane.add(fieldPane, BorderLayout.CENTER);

		JScrollPane scrollPane = new JScrollPane();
		fieldPane.add(scrollPane, BorderLayout.CENTER);

		table = new JTable();
		scrollPane.setViewportView(table);

		balancePane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 5));
		fieldPane.add(balancePane, BorderLayout.SOUTH);

		lbVl_Fatura = new JLabel("0,00");
		lbVl_Fatura.setHorizontalAlignment(SwingConstants.RIGHT);
		balancePane.add(lbVl_Fatura);

		buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5));
		contentPane.add(buttonPane, BorderLayout.SOUTH);

		JButton btnNovo = new JButton("Novo");
		btnNovo.setContentAreaFilled(false);
		btnNovo.setIcon(new ImageIcon(JIFFatura.class
				.getResource("/img/textfield.png")));
		btnNovo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

			}
		});
		btnNovo.setMnemonic('N');
		buttonPane.add(btnNovo);

		JButton btnEditar = new JButton("Editar");
		btnEditar.setContentAreaFilled(false);
		btnEditar.setIcon(new ImageIcon(JIFFatura.class
				.getResource("/img/textfield_rename.png")));
		btnEditar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

			}
		});
		btnEditar.setMnemonic('E');
		buttonPane.add(btnEditar);

		JButton btnExcluir = new JButton("Excluir");
		btnExcluir.setContentAreaFilled(false);
		btnExcluir.setIcon(new ImageIcon(JIFFatura.class
				.getResource("/img/delete.png")));
		btnExcluir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

			}
		});
		btnExcluir.setMnemonic('X');
		buttonPane.add(btnExcluir);

	}

}
